package com.app.listener;

import cn.hutool.core.date.DateUtil;
import com.app.event.ComplaintEvent;
import com.app.model.ComplaintModel;
import com.app.service.ComplaintService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @ClassName ProcessStartupListener
 * @Description ProcessStartupEvent的 业务处理方法
 * @Author yoominic
 * @Date 2022/10/26 14:08 周三
 * @Version 1.0.0
 **/
@Slf4j
@Component
public class Listener {

    @Autowired
    private ComplaintService complaintService;


    @EventListener
    @Async
    public void SysMessageListener(ComplaintEvent complaintEvent) {
        log.info("系统消息开始活跃,时间:{}", DateUtil.now());
        this.complaintService.pushStatus((ComplaintModel)complaintEvent.getSource());
    }
}
